// ==UserScript==
// @name          Gmail Air Skin 2 (with ads-block)
// @namespace     http://www.amio.cn/
// @description	  Gmail Air Skin 2 with ads-block.
// @version       2.4.4
// @date          2009-09-02
// @creator       amio
// @include       http://mail.google.com/*
// @include       https://mail.google.com/*
// @include       http://*.mail.google.com/*
// @include       https://*.mail.google.com/*
// ==/UserScript==

(function() {

	var cssGlobal =
			// ======================== Global
			// all, Contacts
			"body.cP, #ContactManager *," +
			// Side Column & All Nav Button & Settings content & button
			".pp *, .pX *, .v *, .goog-imageless-button-content" +
			// for win,mac,linux
			"{ font-family: verdana, geneva, kalimati, sans-serif !important }" +
			// Setting page LANUGAGE SELECT height fix
			".v9 select { height: 23px !important }" +
			// input or textarea border
			".nr { border-color: #AAA !important }" +
			".nr:focus { border-color: #73A6FF !important }" +
			// Footer
			"div.l2 { font-family: verdana, geneva, kalimati, sans-serif !important }" +
			"div.mn { display: none !important } /*google ad*/";

	var cssSideColumn =
			// ======================== Side Column : NAV
			".n3 a { text-decoration: none !important }" +
			".n3 { padding: 0 !important } /* SideBar: Inbox ~ Labels Displyed */" +
			".n3 .pk { left: 0 !important } /* remove left -4 margin */" +
			".n3 tr.ol { background-color: transparent !important } /* remove trash link additional background-color */" +
			".nM .CM { display: none !important } /* Hide Devided line */" +
			// modify new standalone Current Nav Highlight Background
			".n3 .pk { margin-top: 1px !important } /* down 1px */" +
			".n3 .pk .m { margin-bottom: -2px !important } /* bottom up 1px */" +
			// Nav Main Item ( ".n3 > div.pk + div:not(.pk) > table" for Only Navs, except Labels )
			".n3 > div.pk + div:not(.pk) > table .n2 { margin-right: 0 !important }" +
			".n3 > div.pk + div:not(.pk) > table .nU { position: relative !important; padding: 0 !important }" +
			".n3 > div.pk + div:not(.pk) > table .nU > a.n0 { display: block !important; line-height: 21px !important; padding-left: 6px; margin: 1px 2px 1px 0 !important; border: 1px solid #CDE; -moz-border-radius: 5px 0 0 5px }" +
			".n3 > div.pk + div:not(.pk) > table .nU > a.n0:hover { background-color: #E0ECFF !important }" +
			".n3 > div.pk + div:not(.pk) > table .nU > img { position: absolute !important; top: 5px; right: 6px }" +
			// Current Nav ( normal & Trash, "Drag To" Hover Condition )
			".n3 > div.pk + div:not(.pk) > table tr.nZ .nU>a.n0," +
			".n3 > div.pk + div:not(.pk) > table tr.ol .nU>a.n0," +
			".n3 > div.pk + div:not(.pk) > table tr.nY .nU > a.n0 { border-color: transparent }" +
			// Current Nav Link Background ( remove content mouseover highlight, "Drag To" Hover Condition )
			".n3 > div.pk + div:not(.pk) > table .nZ .nU a.n0:hover," +
			".n3 > div.pk + div:not(.pk) > table .ol .nU a.n0:hover," +
			".n3 > div.pk + div:not(.pk) > table tr.nY .nU > a.n0:hover { background-color: transparent !important }" +
			// Compose & Contacts & Tasks
			".pz .k { margin-top: -4px !important; margin-bottom: -4px !important; }" +
			".pz .qk { padding: 0 !important }" +
			".pz:not(.pk) .n { margin: 0 !important }" +
			".pz span { font-size: 13px; line-height: 22px; text-decoration: none !important; display: block; border: 1px solid #CDE; text-align: center; -moz-border-radius: 4px }" +
			".pz:not(.pX) span { border-color: transparent !important }" +
			".pz:not(.pk) span { font-weight: bold; color: #666 !important }" +
			".pz:not(.pk) span:hover { background-color: #E0ECFF }" +
			// ======================== Side Column : ELSE
			// Labels: displayed
			".oo > .nM > .n3 > div.CM + div { margin: 10px 4px 0 0; -moz-border-radius: 5px 5px 0 0; border-bottom-width: 0 }" +
			".oo > .n6 { margin-right: 4px }" +
			".n8 { display: none }" +
			// Labels: Pop button
			".n4 { position: relative !important; left: 0 !important; text-align: center !important }" +
			".n4:hover { background-color: #D5E6FF !important }" +
			".n4 > span { padding-right: 6px !important; text-decoration: none !important }" +
			// Labels: PopUp
			".CI { left: 7px !important }" +
			// Labels: Down Arrow ( For WinXP )
			".pM { position: relative; top: -1px }" +
			".p8 { font-size: 12px !important }" +
			// remove invite box
			"div.pY { display: none !important }" ;

	var cssRemoveChatbox = "div.s { display: none !important }";

	var cssThreadList =
			// ======================== Thread List
			// List Header & Footer
			".D * { font-family: verdana, geneva, kalimati, sans-serif !important }" +
			// text link highlight
			".D span[role=\"link\"]:hover, .AP:hover { color: red !important; text-decoration: underline !important }" +
			// Thread LIST
			"table.F * { font-family: verdana, geneva, kalimati, sans-serif !important }" +
			// All Conversation Item
			"tr.zA>td { padding: 0 5px 0 1px !important; line-height: 23px !important }" +
			"tr.zA>td>div { height: 23px !important }" +
			// blank thread tr
			"tr.zs { height: 24px !important }" +
			// unread
			"tr.zE:hover { background-color: #E1ECFF !important; background-image: none !important }" +
			// read
			"tr.yO:hover { background-color: #D4E4FF !important; background-image: none !important }" +
			// checked
			"tr.x7 { background-color: #FFC !important; }" +
			"tr.x7:hover { background-color: #FFE699 !important; background-image: none !important }" +
			// smaller right side date td
			"col.xX { width: 75px !important; padding-left: 0 !important }" +
			// label [ar,as > at > au > av]
			"div.ar { padding-top: 2px !important; height: 18px !important }" +
			"div.au { padding: 1px !important }" +
			"div.av { padding: 0 2px !important; font-size: 12px !important; line-height: 15px !important }";

	var cssConversation =
			// ======================== Conversation
			// remove ads
			".u5, .u8 { display: none !important }" +
			// Quick Link button ( Print All, New Window, etc ) position
			"table.iY > tr > td:first-child + td > div { width: auto !important }" +
			"table.iY > tr > td:first-child + td + td > div { width: 0 !important; position: relative !important }" +
			"table.iY > tr > td:first-child + td + td > div > div { position: absolute !important; right: 0 !important; top: 0 !important }" +
			// Quick Link button ( Print All, New Window, etc ) style
			"table.iY div.hj { width: auto !important; font-family: verdana, geneva, kalimati, sans-serif !important }" +
			"table.iY div.hj div.hk { display: inline !important; padding-right: 10px !important }" +
			"table.iY div.hj div.hk span img { display: none !important }" +
			"table.iY div.hj div.hk span {" +
			"	padding: 0px 6px 1px 6px !important;" +
			"	border: 1px solid #C3D9FF !important;" +
			"	border-top-width: 0 !important;" +
			"	-moz-border-radius: 0 0 4px 4px !important}" +
			"table.iY div.hj div.hk span u { text-decoration: none !important }" +
			"table.iY div.hj div.hk span:hover { background-color: #C3D9FF !important }" +
			// Mail Title and Labels
			"div.if h1.ha { font-size: 20px !important; line-height: 26px !important; font-family: Georgia, serif !important; margin-top: 24px !important; position: relative !important }" +
			"div.if h1.ha span.hP { padding: 0 !important }" +
			"div.if h1.ha span:first-child + span { position: absolute !important; top: -22px !important; left: 1px !important }" +
			"div.if h1.ha table * { font-size: 12px !important; line-height: 15px !important }" +
			// Reply Box resize
			"div[class=\"ip iq\"] { margin-right: 13px !important }" +
			"textarea.ir { width: 100% !important }" +
			// "show details" fix (blue frame right-side)
			"table[class=\"T1HY1 nH iY\"] { width: 100% !important }" +
			// font family
			".gE *," +
			".gB div, .gB span { font-family: verdana, geneva, kalimati, sans-serif !important }";

	var cssElse =
			".goog-menuitem * { white-space: nowrap !important }" +
			".goog-tristatemenuitem-highlight, .goog-menuitem-highlight { background-color: #E0ECFF !important }";

	// ======================== Build All CSS
	var gapCSS = cssGlobal + cssSideColumn + cssThreadList + cssConversation + cssElse;

	// ======================== Insert  CSS
	if (typeof GM_addStyle != "undefined") {
		GM_addStyle(gapCSS);
	} else if (typeof addStyle != "undefined") {
		addStyle(gapCSS);
	} else {
		var heads = document.getElementsByTagName("head");
		if (heads.length > 0) {
			var node = document.createElement("style");
			node.type = "text/css";
			node.appendChild(document.createTextNode(gapCSS));
			heads[0].appendChild(node);
		}
	}
})();